package engine.entities;

import engine.colliders.Border;
import engine.colliders.Bounce;
import engine.colliders.CollisionResolver;
import engine.colliders.Damage;
import engine.controllers.Controller;
import engine.physics.Gravity;
import engine.physics.PhysicsResolver;
import engine.render.Sprite;

public class EntityFactory {

	public Entity createPlayer(Controller c, int posx, int posy) {
		Sprite playerSprite = new Sprite("mario.png");
		Entity player = new Entity();

		player.setController(c);
		player.getSpatial().setPosition(posx, posy);
		player.setEnergy(new Energy(100));
		player.getPhysical().setMass(2);

		CollisionResolver border = new Border(800, 600);
		CollisionResolver damage = new Damage();
		CollisionResolver bounce = new Bounce();

		player.addCollider(border);
		player.addCollider(bounce);
		player.addCollider(damage);

		PhysicsResolver gravity = new Gravity();
		player.addPhysics(gravity);

		player.setSprite(playerSprite);

		return player;
	}

	public Entity createGumba(int posx, int posy) {
		PhysicsResolver physics = new Gravity();

		CollisionResolver border = new Border(800, 600);
		CollisionResolver damage = new Damage();

		Sprite enemySprite = new Sprite("gumba.png");
		Entity gumba = new Entity();
		gumba.getSpatial().setPosition(posx, posy);
		gumba.setEnergy(new Energy(80));

		gumba.addCollider(border);
		gumba.addCollider(damage);

		gumba.addPhysics(physics);

		gumba.setSprite(enemySprite);

		return gumba;
	}

}
